/*
 * BeanManager.java
 *
 * Created on 1 novembre 2007, 23:53
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.ifips5.nal.epizza.web;

import toPDF.CreationPDF;

/**
 *
 * @author Moi
 */
public class BeanManager
{
   
    private PizzaManager pizzaManager = null;
    private IngredientManager ingredientManager = null;
    private BoissonManager boissonManager = null;
    private MenuManager menuManager = null;
    private CommandeManager commandeManager = null;
    private ClientManager clientManager = null;

    
    /** Creates a new instance of BeanManager */
    public BeanManager()
    {
    }
    
    
    public PizzaManager getPizzaManager()
    {
        if(pizzaManager == null)
            pizzaManager = new PizzaManager(this);
        return pizzaManager;
    }
    
    public IngredientManager getIngredientManager()
    {
        if(ingredientManager == null)
            ingredientManager = new IngredientManager(this);
        return ingredientManager;
    }
    
    public BoissonManager getBoissonManager()
    {
        if(boissonManager == null)
            boissonManager = new BoissonManager(this);
        return boissonManager;
    }
    
    public MenuManager getMenuManager()
    {
        if(menuManager == null)
            menuManager = new MenuManager(this);
        return menuManager;
    }
    
    public CommandeManager getCommandeManager()
    {
        if(commandeManager == null)
            commandeManager = new CommandeManager(this);
        return commandeManager;
    }
    
    public ClientManager getClientManager()
    {
        if(clientManager == null)
            clientManager = new ClientManager(this);
        return clientManager;
    }
    
    public void setPizzaManager(PizzaManager pizzaManager)
    {
        this.pizzaManager = pizzaManager;
    }

    public void setIngredientManager(IngredientManager ingredientManager)
    {
        this.ingredientManager = ingredientManager;
    }

    public void setBoissonManager(BoissonManager boissonManager)
    {
        this.boissonManager = boissonManager;
    }



    public void setMenuManager(MenuManager menuManager)
    {
        this.menuManager = menuManager;
    }



    public void setCommandeManager(CommandeManager commandeManager)
    {
        this.commandeManager = commandeManager;
    }

 

    public void setClientManager(ClientManager clientManager)
    {
        this.clientManager = clientManager;
    }
    
    public void updatePDF()
    {
        this.getIngredientManager().getIngredientList().clear();
        
        
        this.getBoissonManager().getBoissonList().clear();
        this.getBoissonManager().loadBoissons();
        
        this.getMenuManager().getMenuList().clear();
        this.getMenuManager().loadTypeMenu();
        
        this.getPizzaManager().getPizzaList().clear();
        this.getPizzaManager().getAllPizzas();
 
        CreationPDF.getPDF(this);

        this.getIngredientManager().getIngredientList().clear();
        this.getBoissonManager().getBoissonList().clear();
        this.getMenuManager().getMenuList().clear();
        this.getPizzaManager().getPizzaList().clear();

    }
}
